<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <title>请假申请</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/resources/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/resources/css/public.css" media="all">
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend style="color: #35c6d3;font-weight:bold;">个人信息管理</legend>
</fieldset>

<div style="padding-top: 2%;padding-left: 10%;padding-right: 10%">
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <label class="layui-form-label">学号</label>
            <div class="layui-input-block">
                <input type="text" name="id" autocomplete="off" disabled="disabled" th:value="${session.user.id}" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">姓名</label>
            <div class="layui-input-block">
                <input type="text" name="studentname" autocomplete="off" disabled="disabled" th:value="${session.user.name}" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">级别</label>
            <div class="layui-input-block">
                <input type="text" name="grade" autocomplete="off" disabled="disabled" th:value="${session.user.grade}" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">班级</label>
            <div class="layui-input-block">
                <input type="text" name="classes" autocomplete="off" disabled="disabled" th:value="${session.user.classes}" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">手机号</label>
            <div class="layui-input-block">
                <input type="tel" name="phone" lay-verify="required|phone" lay-reqtext="手机号不能为空!" autocomplete="off" placeholder="请输入手机号"
                       th:value="${session.user.phone}" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">家庭住址</label>
            <div class="layui-input-block">
                <input type="text" name="address" lay-reqtext="家庭住址不能为空!" autocomplete="off" placeholder="请输入家庭住址"
                       th:value="${session.user.address}" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal" id="doSubmit" lay-submit="" lay-filter="doSubmit">确认提交</button>
                <button type="reset" class="layui-btn layui-btn-normal">重置</button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="/resources/layui/layui.js" charset="utf-8"></script>

<script type="text/javascript">
    layui.use(['form', 'layer','jquery'], function(){
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer
        $ = layui.jquery;

        //监听提交
        form.on('submit(doSubmit)', function(data){
            $.post("/user/updateUser",data.field,function(rs){
                layer.msg(rs.msg);
                if(rs.code != 200){
                    layer.msg(rs.msg);
                }else{
                    layer.msg(rs.msg);
                    location.reload();
                }
            });
            return false;
        });

    });
</script>

</body>
</html>